import Vue from 'vue'
import Vuex from 'vuex'
// 模块
import user from './model/user.js'
import diary from './model/diary.js'

Vue.use(Vuex)

const store = new Vuex.Store({
	state: {
		user: {},
		diary: {},
		searchKey: []//关闭的群禁言
	},
	mutations: {
		changeSearchKey(state,value){
	      state.searchKey.push(value)
	    },
		delSearchKey(state,value){
			//删除不同的群禁言
			state.searchKey.splice(state.searchKey.indexOf(value),1);
		}
	},
	actions: {
		 setSearchKey(context,value){   
		      context.commit('changeSearchKey',value)
		   },
		   delSearchKey(context,value){
		        context.commit('delSearchKey',value)
		     }
	},
	modules: {
		user,
		diary
	}
})

export default store
